<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="CloudStorage.*" %>
<%
            int size = 0;
            if (session.getAttribute("cart") != null) {
                size = ((Cart) session.getAttribute("cart")).getSize();
            }
%>
<html>
    <head>
        <title>CloudShare - Register New Account</title>
        <link rel="SHORTCUT ICON" href="images/favicon.ico" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="style.css" />
<style>

a:link {
    color: #F6F1F0;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
#register_form{
	float: left;
	margin-left: 12px;
}
#registered{
margin:10px;
}
#registered a{
color:#A85C20;
}
</style>
    </head>

    <body>
        <div id="header">
            <div class="inside"> <a href="#" class="logo"><img src="images/logo2.gif" alt="" width="131" height="83" /></a>
                <p class="slogan">Share on Clouds!</p>
                <div id="cart">
                    <ul>
                        <li><a href="downloadcart.jsp"><img alt="cart" src="images/cart.png">  Download Cart (<%=size%>)</a> </li>
                    </ul>
                </div>
                <a href="faq.jsp" class="rss"><img src="images/rss.jpg" alt="" width="39" height="41" /></a> </div>

            <div id="menu">
               <% if (session.getAttribute("status") == null) {%>
                <ul>
                    <li><a href="index.jsp"><img src="images/but_home.jpg" alt="" width="148" height="40" /></a></li>
                    <li><a href="login.jsp"><img src="images/but_login.jpg" alt="" width="147" height="40" /></a></li>
                    <li><a href="register.jsp"><img src="images/but_reg.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="downloads.jsp"><img src="images/but_down.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="upload.jsp"><img src="images/but_upload.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="buy.jsp"><img src="images/but_buy.jpg" alt="" width="146" height="40" /></a></li>

                </ul>
				<% } else { %>
                <ul>
                    <li><a href="index.jsp"><img src="images/but_home.jpg" alt="" width="148" height="40" /></a></li>
                    <li><a href="account.jsp"><img src="images/but_account.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="downloads.jsp"><img src="images/but_down.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="upload.jsp"><img src="images/but_upload.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="buy.jsp"><img src="images/but_buy.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="LogoutServlet"><img src="images/but_logout.jpg" alt="" width="147" height="40" /></a></li>
                </ul>
                <%}%>

            </div>
            <div class="headimage"><img src="images/picture.jpg" alt=""/> </div>
        </div>
        <div class="inside">
        </div>
        <div id="main">
            <div class="inside">
                <div id="blocks" >
          <div id="register_block">
                    <h1>Register New Account</h1>
                    <img src="images/register_icon.gif"/>
                    <%if (session.getAttribute("registered") != null) {

                    %>
                    <div id="registered"><p>You were successfully registered! <br/>Go to <a href="index.jsp">my Account </a>page!</p></div>
                    <%}else{%>
                    <div id="register_form">
                    <p>Please fill all the fields.</p>
                    <form method="post" action="RegisterServlet">
                        <table width="100%" height="100%" border="0">
                            <tr>
                                <td width="100">Surname:</td>
                                <td width="200"><input name="surname" type="text"/>
                                <td>
                                    <% if (session.getAttribute("surname error message") != null) {%>
                                    Please, type your surname!
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100">Name:</td>
                                <td width="200"><input name="name" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("name error message") != null) {%>
                                    Please, type your name!
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100"> E-mail:</td>
                                <td width="200"><input name="email1" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("email1 error message") != null) {%>
                                    Please, type your email!
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100">Verify E-mail:</td>
                                <td width="200"><input name="email2" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("email2 error message") != null) {%>
                                    Please, retype your email!
                                    <%} else if (session.getAttribute("email not match error message") != null) {%>
                                    Your email is not the same with above!
                                    <%} else if (session.getAttribute("email exists") != null) {%>
                                    <p> Email <%=session.getAttribute("email exists")%> is already in use! </p>
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100">Username:</td>
                                <td width="200"><input name="username" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("username error message") != null) {%>
                                    Please, type your username!
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100">Password:</td>
                                <td width="200"><input name="password1" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("password1 error message") != null) {%>
                                    Please, type your password!
                                    <%} else if (session.getAttribute("username exists") != null) {%>
                                    <p> Username <%=session.getAttribute("username exists")%> is already in use! </p>
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100">Verify Password:</td>
                                <td width="200"><input name="password2" type="text"></td>
                                <td>
                                    <% if (session.getAttribute("password2 error message") != null) {%>
                                    Please, retype your email!
                                    <%} else if (session.getAttribute("password not match error message") != null) {%>
                                    Your password is not the same with the password above!
                                    <%}%>
                                </td>
                            </tr>
                            <tr>
                                <td width="100"><input type="image" src="images/clear.png"/></td>
                                <td><input type="image" src="images/register.png" name="register"/></td>
                            </tr>
                        </table>
                    </form>
                    </div>
                    <%}%>
                    </div>
                </div>
            </div>
        </div>
        <div id="footer">
            <div class="inside">
                <p>CloudShare &copy; 2010   |  Developed and Designed by Panoylhs &amp; Roumdic S.A.</p>
            </div>
        </div>
    </body>
</html>
